package com.edu.d6_api_StringBuilder;

/**
 * StringBuilder的使用
 */
public class Test {
    public static void main(String[] args) {
        int[] b=null;
        System.out.println(toString(b));
        int[] a={11,22,33,44,55};
        System.out.println(toString(a));
    }
    public static String toString(int[] a){
        if(a==null){
            return null;
        }else{
            StringBuilder builder = new StringBuilder("[");
            for (int i = 0; i < a.length; i++) {
                builder.append(a[i]).append(i==a.length-1?"":",");
            }
            builder.append("]");
            return builder.toString();
        }
    }
}
